package me.out1kiss.www.main;

public class RandomUtil {

    /**
     * 随机返回1到length长度的字符串
     */
    public static String getRandomStr(int length) {
        length = getRandom(1, length).intValue();
        String str = "`1234567890-=][poiuytrewqasdfghjkl;'/.,mnbvcxzQWERTYUIOPLKJHGFDSAZXCVBBNM";
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < length; i++) {
            builder.append(str.charAt(getRandom(0L, str.length() - 1).intValue()));
        }
        return builder.toString();
    }

    public static Integer getRandomInteger() {
        return getRandom(Integer.MIN_VALUE, Integer.MAX_VALUE).intValue();
    }

    public static Long getRandomLong() {
        return getRandom(Long.MIN_VALUE, Long.MAX_VALUE);
    }

    public static Long getRandom(long min, long max) {
        return (long) (min + Math.random() * (max - min + 1));
    }

}
